package com.jacken.mars.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jacken.mars.commons.annotation.BaseAnnotationNote;
import com.jacken.mars.entity.req.SysNoticeReq;
import com.jacken.mars.entity.resp.R;
import com.jacken.mars.entity.base.PageInfo;
import com.jacken.mars.entity.base.BasePageRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import lombok.AllArgsConstructor;

import java.util.Arrays;

import com.jacken.mars.entity.SysNotice;
import com.jacken.mars.service.ISysNoticeService;

/**
 * SysNotice 控制层
 *
 * @Author wq
 * @Date 2021-02-06
 **/
@RestController
@RequestMapping("admin/sysNotice")
@AllArgsConstructor
public class SysNoticeController {

    private final ISysNoticeService sysNoticeService;

    /**
     * 添加系统公告
     *
     * @param req
     * @return
     */
    @PostMapping("/add")
    @BaseAnnotationNote
    public R add(@RequestBody SysNoticeReq req) {
        sysNoticeService.add(req);
        return R.success();
    }

    /**
     * 列表
     *
     * @param req
     * @return
     */
    @PostMapping("/page")
    @BaseAnnotationNote
    public R sysNoticePage(@RequestBody SysNoticeReq req) {
        return R.success(sysNoticeService.sysNoticePage(req));
    }


}